package com.telit.firecommand.controller;

import com.telit.common.constant.Constant;
import com.telit.common.entity.DataReturn;
import com.telit.firecommand.entity.ForestLandInformation;
import com.telit.firecommand.service.ForestLandInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author:zhangwei
 * @Description:
 * @Time:Created on 2022/9/27 9:02
 */
@RestController
@Api(tags = "林地信息接口", description = "forester")
@RequestMapping("/forest-land-information")
public class ForestLandInformationController {

    @Autowired
    ForestLandInformationService forestLandInformationService;

    @PostMapping(value = "/add", produces = "application/json;charset=UTF-8")
    @ApiOperation(value = "林地信息接口", httpMethod = Constant.REQUEST_METHOD_POST)
    public DataReturn add(@RequestBody ForestLandInformation forestLandInformation){
        forestLandInformationService.add(forestLandInformation);
        return DataReturn.ok();
    }

    @GetMapping(value = "/forestLandInformation")
    @ApiOperation(value = "根据火情id查询林地信息")
    public DataReturn<ForestLandInformation> forestLandInformation(@RequestParam("fireId")String fireId){
        ForestLandInformation forestLandInformation = forestLandInformationService.forestLandInformation(fireId);
        return DataReturn.ok(forestLandInformation);
    }
}
